<?php
if ($login_by_username AND $login_by_email)
    $login_label = lang('label_login_user_and_email');
else if ($login_by_username)
    $login_label = lang('label_username');
else
    $login_label = lang('label_email');
?>

<div id="box_login">
    <a href="<?php echo site_url('home');?>"><img src="<?php echo img_theme('logo.png');?>"></a>
    <p class="title_high"><?php echo lang('label_login');?><hr></p>
    
    <form method="post" accept-charset="utf-8" action="<?php echo site_url(uri_string())?>">
        <div>
        <label for="login"><?php echo $login_label;?></label>
        <input type="text" name="login" id="login" value="<?php echo set_value('login');?>" maxlength="80" required autofocus />
        </div>
        <?php if (isset($errors['login'])):?>
        <div id="bubble">
            <?php echo form_error('login'); ?>
            <?php echo isset($errors['login'])?$errors['login']:''; ?>
            <a href="<?php echo site_url('home');?>"><img src="<?php echo img_theme('mcgarnnigan/mcgarnnigan_bla.png');?>"></a>
        </div>
        <?php endif;?>
        <div>
        <label for="password"><?php echo lang('label_password');?></label>
        <input type="password" name="password" id="password" required />
        </div>
        <?php if (isset($errors['password'])):?>
        <div id="bubble">
            <?php echo form_error('password'); ?>
            <?php echo isset($errors['password'])?$errors['password']:''; ?>
            <a href="<?php echo site_url('home');?>"><img src="<?php echo img_theme('mcgarnnigan/mcgarnnigan_bla.png');?>"></a>
        </div>
        <?php endif;?>
        <br>

        <?php if ($show_captcha): ?>
        <?php if ($use_recaptcha): ?>

            <div id="recaptcha_image"></div>

            <a href="javascript:Recaptcha.reload()">Get another CAPTCHA</a>
            <div class="recaptcha_only_if_image"><a href="javascript:Recaptcha.switch_type('audio')">Get an audio CAPTCHA</a></div>
            <div class="recaptcha_only_if_audio"><a href="javascript:Recaptcha.switch_type('image')">Get an image CAPTCHA</a></div>

            <div class="recaptcha_only_if_image">Enter the words above</div>
            <div class="recaptcha_only_if_audio">Enter the numbers you hear</div>

            <input type="text" id="recaptcha_response_field" name="recaptcha_response_field" />
            <?php echo form_error('recaptcha_response_field'); ?>
            <?php echo $recaptcha_html; ?>
            <?php else: ?>
            <br>
            <p>Enter the code exactly as it appears:</p>
            <?php echo $captcha_html; ?><br>
            <label for="captcha" />Confirmation Code</label>
            <input type="text" name="captcha" id="captcha" maxlength="8" required /><br>
            <span><?php echo form_error('captcha'); ?></span>
            <?php endif;?>
        <?php endif;?>
        <div class="em">
            <?php //echo form_checkbox($remember); ?>
            <?php //echo form_label(lang('label_remember'), $remember['id']); ?>
            <a href="<?php echo site_url('auth/forgot_password');?>"><?php echo lang('label_forgoten_password');?></a>
        </div>

        <input type="submit" name="submit" value="<?php echo lang('label_log_in');?>" class="button" />

    </form>
</div>